<?php
namespace Novel\Controller;

use Zend\Mvc\Controller\AbstractRestfulController;
use Zend\View\Model\JsonModel;

/**
 * API 查询当前小说
 * Class IndexController
 * @package Novel\Controller
 */
class IndexController extends AbstractRestfulController{


    protected $novelTable;

    public function get($id){
        $novelTable=$this->getNovelTable();
        return new JsonModel($novelTable->getById($id));


    }


    protected  function getNovelTable(){
        if(!$this->novelTable){
             $sm=$this->getServiceLocator();
            $this->novelTable=$sm->get('Novel\Model\NovelTable');
        }
        return $this->novelTable;
    }


}